package cn.jetbrain.netbeans.pdfviewer;

import java.io.IOException;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObjectExistsException;
import org.openide.loaders.MultiDataObject;
import org.openide.nodes.Node;
import org.openide.nodes.Node.Cookie;
import org.openide.util.Lookup;

public class PDFDataObject extends MultiDataObject {

    public PDFDataObject(FileObject pf, PDFDataLoader loader) throws DataObjectExistsException, IOException {
        super(pf, loader);
        if (pf != null) {
            getCookieSet().add(new PDFOpenSupport(this));
        }
    }

    public void addCookie(Cookie ck){
        getCookieSet().add(ck);
    }

    @Override
    protected Node createNodeDelegate() {
        return new PDFDataNode(this, getLookup());
    }

    @Override
    public Lookup getLookup() {
        return getCookieSet().getLookup();
    }
}
